import axios from "axios";
import { takeEvery, put } from "redux-saga/effects";
import { API } from "../../config";
import { product_id, product_id_success } from "../actions/product.action";


function* handleProduct(action) {
    let res = yield axios.get(`${API}/product/${action.payload.productId}`)
    yield put(product_id_success(res.data))
}

export default function* productSagaId() {
    yield takeEvery(product_id, handleProduct)
}